
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:new_credit_factory/app.dart';
// import 'package:new_credit_factory/BussinessModule/LittleMicroLoan/HomeModule/HomePage/page.dart';
enum backType{
  microLoanBack,
  singleLoanBack,
  creditApplyBack,
}
// class NavigationBarWidget extends StatefulWidget{
//   String title;//导航名
//   dynamic state;//状态
//   Function dispatch;//home键函数
//   dynamic viewService;
//
//   NavigationBarWidget({this.title,this.state,this.dispatch,this.viewService})
//       : assert(title == null),
//         assert(state == null),
//         assert(dispatch == null),
//         assert(viewService == null);
//
//   @override
//   State<StatefulWidget> createState() {
//     return NavigationBarWidgetState(title:title,state: state,dispatch: dispatch,viewService: viewService);
//   }
// }
//
// class NavigationBarWidgetState extends State<NavigationBarWidget>{
//   String title;//导航名
//   dynamic state;//状态
//   Function dispatch;//home键函数
//   dynamic viewService;
//   NavigationBarWidgetState({this.title,this.state,this.dispatch,this.viewService})
//       : assert(title == null),
//         assert(state == null),
//         assert(dispatch == null),
//         assert(viewService == null);
//
//   @override
//   Widget build(BuildContext context) {
//     // TODO: implement build
//     return NavigationWidget();
//   }

  //导航栏
  Widget NavigationWidget(String title,dynamic state,{dynamic dispatch, dynamic viewService,backType actionType}) {
    return Stack(
      children: <Widget>[
        Container(
          width: ScreenUtil.screenWidth,
          height: ScreenUtil().setWidth(60),
          color: Color(0xffFFFFFF),
        ),
        Positioned(
          child: InkWell(
            onTap: () {
              Navigator.pop(viewService.context);
            },
            child: Container(
              width: ScreenUtil().setWidth(30),
              height: ScreenUtil().setWidth(30),
              child: Image.asset(
                'images/back_gray.png',
                fit: BoxFit.contain,
              ),
            ),
          ),
          left: ScreenUtil().setWidth(30),
          top: ScreenUtil().setWidth(17),
        ),
        Positioned(
          child: Container(
            width: ScreenUtil().setWidth(120),
            height: ScreenUtil().setWidth(30),
            child: Text(
              title,
              style: TextStyle(
                  color: Color(0xff000000), fontSize: ScreenUtil().setSp(19)),
            ),
          ),
          left: ScreenUtil.screenWidth / 2 - ScreenUtil().setWidth(53),
          top: ScreenUtil().setWidth(19),
        ),
        Positioned(
          child: InkWell(
            onTap: () {
              // dispatch()?Navigator.popUntil(viewService.context,ModalRoute.withName(RouteConfig.homePage)):
              // switch(actionType){
              //   case backType.creditApplyBack:
              //     Navigator.of(viewService.context).pushAndRemoveUntil(
              //         MaterialPageRoute(
              //             builder: (context) => RouteConfig.routes.buildPage(RouteConfig.CreditCardPage, null)), (route) => route == null);
              //     break;
              //    default:
              //      Navigator.of(viewService.context).pushAndRemoveUntil(
              //          MaterialPageRoute(
              //              builder: (context) => RouteConfig.routes.buildPage(RouteConfig.homePage, null)), (route) => route == null);
              //    break;
              // }
              },
            child: Container(
              width: ScreenUtil().setWidth(30),
              height: ScreenUtil().setWidth(30),
              child: Image.asset(
                'images/home_gray.png',
                fit: BoxFit.contain,
              ),
            ),
          ),
          right: ScreenUtil().setWidth(27),
          top: ScreenUtil().setWidth(17),
        )
      ],
    );
  }
// }
